<?php
class Pages extends CI_Controller {

    public function main($page = 'main')
    {
        $this->load->helper('url');//加载url，URL 辅助函数 帮助我们创建链接
        // $this->load->view('index', array('base_url'=>$base_url));
        if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php'))
        {
            show_404();
        }

        $this->load->library('session');
        $data['userName'] = $this->session->userdata('userName'); // Capitalize the first letter
        $data['id'] =$this->session->userdata('id');
        //print_r( $_SESSION['userName']);
        // print_r( $_SESSION['id']);exit;
        $this->load->view('pages/'.$page, $data);
    }
    public function view($page = 'login')
    {
        $this->load->helper('url');//加载url，URL 辅助函数 帮助我们创建链接
        $data['info'] = "";
        $this->load->view($page, $data);
    }
}